//
//  OriginCalloutView.m
//  dangdang
//
//  Created by air on 16/3/2.
//  Copyright © 2016年 luweijie. All rights reserved.
//

#import "OriginCalloutView.h"

@interface OriginCalloutView()

@property (nonatomic, strong) UIImageView *portraitView;
@property (nonatomic, strong) UILabel *subtitleLabel;
@property (nonatomic, strong) UILabel *titleLabel;

@end

@implementation OriginCalloutView

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self)
    {
        self.backgroundColor = [UIColor clearColor];
        [self initSubViews];
    }
    return self;
}

- (void)initSubViews
{
    self.portraitView = [[UIImageView alloc] initWithFrame:CGRectMake(3, 3, self.bounds.size.height - 6, self.bounds.size.height - 6)];
    self.portraitView.layer.cornerRadius = self.portraitView.bounds.size.width / 2;
    self.portraitView.layer.masksToBounds = YES;
    
//    self.portraitView.backgroundColor = [UIColor blackColor];
    [self addSubview:self.portraitView];
    
    self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.portraitView.bounds.size.width + 10, 5, 120, 20)];
    self.titleLabel.font = [UIFont boldSystemFontOfSize:14];
    self.titleLabel.textColor = [UIColor whiteColor];
//    self.titleLabel.text = @"titletitletitletitle";
    [self addSubview:self.titleLabel];
    
    self.subtitleLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.portraitView.bounds.size.width + 10, 25, 120, 20)];
    self.subtitleLabel.font = [UIFont boldSystemFontOfSize:14];
    self.subtitleLabel.textColor = [UIColor whiteColor];
//    self.subtitleLabel.text = @"subtitleLabelsubtitleLabelsubtitleLabel";
    [self addSubview:self.subtitleLabel];
}

- (void)setTitle:(NSString *)title
{
    self.titleLabel.text = title;
}

- (void)setSubtitle:(NSString *)subtitle
{
    self.subtitleLabel.text = subtitle;
}

- (void)setImage:(UIImage *)image
{
    self.portraitView.image = image;
}

@end
